package com.sllp.C71S3TsllpShop;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import com.sllp.C71S3TsllpShop.web.ChatAction;

@SpringBootApplication
@MapperScan("com.sllp.C71S3TsllpShop")
@ServletComponentScan
public class C71S3TsllpShopApplication {

	public static void main(String[] args) {
//		SpringApplication.run(C71S3TsllpShopApplication.class, args);
		SpringApplication springApplication = new SpringApplication(C71S3TsllpShopApplication.class);
        ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
        
		//解决WebSocket不能注入的问题
        ChatAction.setApplicationContext(configurableApplicationContext);
	}

	@Bean
	public ServerEndpointExporter serverEndpointExporter() {
		return new ServerEndpointExporter();
	}
}
